Log Configuration |
|
The configuration specified in Log4jConfiguration.xml defines the behavior of logging system. The default structure of the log configuration file is as shown below and creates daily a new log file:
<appender class="com.eibus.util.logger.appender.ProcessNamedDailyRollingFileAppender" name="file"> <param name="File" value="%N.xml"/> <param name="DatePattern" value="&apos;.&apos;yyyy-MM-dd"/> <layout class="org.apache.log4j.xml.XMLLayout"> <param name="LocationInfo" value="true"/> </layout> </appender> <root> <priority value="error"/> <appender-ref ref="file"/> </root>
When size limits of the log files are needed, use ProcessNamedSizeRollingFileAppender as below:
<appender class="com.eibus.util.logger.appender.ProcessNamedSizeRollingFileAppender" name="file"> <param name="File" value="%N.xml"/> <param name="Encoding" value="UTF-8" /> <param name="MaxFileSize" value="10MB" /> <param name="MaxBackupIndex" value="10" /> <layout class="org.apache.log4j.xml.XMLLayout"> <param name="LocationInfo" value="true"/> </layout> </appender> <root> <priority value="error"/> <appender-ref ref="file"/> </root>
By default, during installation the installer configures logging with default values. The default configuration looks like this:
<root> <priority value="error"/> <appender-ref ref="file"/> </root>
Parameters required for a logger system include the consumers or appenders, and severity levels. Elements used in the configuration file have been explained as follows:
Element |
Description |
priority |
This represents the type or level of message to be issued. The value attribute can be used to specify the type and its hierarchy. Possible values are Fatal, Error, Warn, Info, and Debug. |
appender |
Appenders are consumers to which the log messages must be sent. These can be specified using the 'class' attribute, in which the fully qualified class name of the consumer must be defined. Example, <appender class='com.eibus.util.logger.appender. ProcessNamedDailyRollingFileAppender' name='file'> Logger system can be configured to various consumers such as the File, E-Mail, Syslog, Windows Event Log and so on. |
<appender-ref > |
This element allows referencing another appender by its name. The ref attribute must match the name of appender declared elsewhere within an <appender> element. |
This section contains the following topic:
Providing Log Configuration Details - This topic contains information on how to configure the severity levels and consumers for log messages.